/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.agile.gcodeviewer;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import javax.swing.JOptionPane;

/**
 *
 * @author Rko
 */
public class ReadgCode {

    public ReadgCode() {

    }

    public void read(String path) {
        File file = new File(path);
        String line;

        try (BufferedReader input = new BufferedReader(new FileReader(file))) {
            line = input.readLine();
            while (line != null) {

                if (line.charAt(0) != ';') {
                    if (!line.startsWith("G1 F1000")) {
                        if (!line.startsWith("G1 Z")) {
                            if (!line.startsWith("G90")) {
                              System.out.println(line);
                            }
                        }
                    }
                }
                
                
                line = input.readLine();

                /*if (line.charAt(0) != ';') {
                 System.out.println(line);
                 continue
                 } else {
                 line = input.readLine();
                 continue;
                 }
                 if (!line.equals("G1 F1000")) {
                 System.out.println(line);

                 } else {
                 line = input.readLine();
                 continue;
                 }
                 if (!line.startsWith("G1 Z")) {
                 System.out.println(line);

                 } else {
                 line = input.readLine();
                 continue;
                 }*/

                /*if (line.charAt(0) == 'X') {
                 String strx = line.split("X")[1];
                 System.out.println(strx);
                 String[] x = strx.split("Y");
                 System.out.println(x[0]);//X
                 int entero = Integer.parseInt(x[0]);
                    
                    
                 strx = x[1];
                 String[] y = strx.split("D");
                 System.out.println(y[0]);//Y
                 strx = y[1];
                 String[] d = strx.split("\\*");
                 System.out.println(d[0]);//D
                 }*/
            }
        } catch (IOException e) {

        }
    }

    public static void main(String[] args) {
        ReadgCode read = new ReadgCode();
        read.read("E:\\agile-pipei\\RS-274X\\enabtmr.gcode");
    }
}
